const HtmlWebpackPlugin = require('html-webpack-plugin');

module.exports = {
  mode: 'development',
  devServer: {
    open: true,
  },
  module: {
    rules: [
      { test: /\.css$/, use: ['style-loader', 'css-loader'] },
      // less-loader 将 less文件里面的 less 代码转换成css 代码 然后交给 css-loader 处理 将器转换成js 代码 然后交给style-loader 处理
      { test: /\.less$/, use: ['style-loader', 'css-loader?modules', 'less-loader'] },
    ],
  },
  plugins: [
    new HtmlWebpackPlugin({
      template: './public/index.html',
    }),
  ],
};
